﻿using System;
using System.Data;
using System.Collections.Generic;

namespace Common
{
    /// <summary>
    /// Summary description for PaginatedList
    /// </summary>
    public class PaginatedInfo<T>
    {
        public int CurrentPage { get; private set; }
        public int TotalPages { get; private set; }
        public List<T> Data { get; private set; }

        public PaginatedInfo(DataTable dataTable, int currentPage, int totalRecords, int pageSize)
        {
            CurrentPage = currentPage;
            TotalPages = (int)Math.Ceiling(totalRecords / (double)pageSize);
            TotalPages = TotalPages > 0 ? TotalPages : 1;
            Data = new TypedList<T>(dataTable);
        }
    }
}
